package org.twndmv.bo;

import java.util.HashMap;
import java.util.Map;

import org.twndmv.exception.NoSuchColorException;

public enum Color {
	
	BLACK("BLACK"),
	BLUE("BLUE"),
	BROWN("BROWN"),
	GRAY("GRAY"),
	GREEN("GREEN"), 
	HAZEL("HAZEL"),
	MAROON("MAROON"),
	MULTICOLORED("MULTICOLORED"),
	PINK("PINK"),
	UNKNOWN("UNKNOWN"),
	ORANGE("ORANGE"),
	PURPLE("PURPLE"), 
	RED("RED"),
	WHITE("WHITE"),
	SANDY("SANDY"),
	BLOND("BLOND"),
	
	
	
	
	BRONZE("BRONZE"),
	DARK_GREEN("DARK GREEN"),
	LIGHT_BLUE("LIGHT BLUE"),
	GOLD("GOLD"),
	BEIGE("BEIGE"),
	YELLOW("YELLOW"),
	TAN("TAN"),
	DARK_BLUE("DARK BLUE"),
	AMETHYST("AMETHYST"),
	COPPER("COPPER"),
	TAUPE("TAUPE"),
	LIGHT_GREEN("LIGHT GREEN"),
	TEAL("TEAL"),
	CHROME("CHROME"),
	CAMOUFLAGE("CAMOUFLAGE"),
	SILVER("SILVER"),
	TURQUOISE("TURQUOISE"),
	LAVENDER("LAVENDER (PURPLE)"),
	MAUVE("MAUVE"),
	CREAM_IVORY("CREAM, IVORY"),
	MAROON_BURGUNDY("MAROON, BURGUNDY");
	
	
	private static final Map<String, Color> map =
            new HashMap<String, Color>();

	static {
		   for (Color color : Color.values()) {
		     map.put(color.name, color);
		   }
		 }
	
	private Color(String name) {
		this.name = name;
	}
	
	private String name;
	
	public String getName() {
		return name;
	}
	
	public static Color translate(String arg) throws NoSuchColorException { 
		Color color = map.get(arg);
		if(color != null) {
			return color;
		} else {
			throw new NoSuchColorException("Color " + arg + " is undefined");
		}
		
	}
	
}
